<?php
/**
 * User: hda
 * Date: 2017/5/6
 * Time: 11:26
 * Progress: 0%
 */

namespace app\index\controller;

use icontroller\wechat\AController;
use icontroller\wechat\index\IAccount;
use logic\wechat\index\LAccount;


class Account extends AController implements IAccount
{
    private $logic;
    public function __construct()
    {
        parent::__construct();
        $this->logic=new LAccount();

    }
    // <editor-fold defaultstate="collapsed" desc="注册配送员">
    public function reg_delivery()
    {
        $flag=$this->logic->logic_reg_delivery();
        if($flag){
            $this->redirect(url('Account/reg_delivery_result'));
        }
        $store=$this->logic->logic_store_data();
        $this->assign('store',$store);
        return $this->fetch();
    }
    // </editor-fold>

// <editor-fold defaultstate="collapsed" desc="提交申请配送员">
    public function register_delivery_submit(){
        $param=array(
            'name'=>input('name'),
            'mobile'=>input('mobile'),
            'wechat'=>input('wechat'),
            'store_id'=>input('store_id')
        );
        return $this->logic->logic_register_delivery_submit($param);
    }
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="申请配送员结果查询">
    public function reg_delivery_result(){
        $res=$this->logic->logic_register_result();
        if($res==false){
            $this->redirect(url('Account/reg_delivery'));
        }
        $this->assign('data',$res);
        return view();
    }
// </editor-fold>


    public function reg_intro(){
        $info=$this->logic->logic_reg_intro();
        $this->assign('info',$info);
        return $this->fetch();
    }

    public function reg_user()
    {
        $info=$this->logic->logic_reg_user();
        $this->assign('info',$info);
        return $this->fetch();
    }

    public function create_reg_user_order(){
        return $this->logic->logic_create_reg_user_order();
    }

    public function create_reg_vip_order(){
        $param=array(
            'watercard_id'=>input('watercard_id')
        );

        return $this->logic->logic_create_reg_vip_order($param);
    }

    public function renewals_watercard(){
        $param=array(
            'user_card_id'=>input('user_card_id'),
        );
        return $this->logic->logic_renewals_watercard($param);
    }

    public function reg_vip()
    {
        $info=$this->logic->logic_reg_vip();
        $this->assign('info',$info);
        return $this->fetch();
    }
}